# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=rakudo-star
pkgver=2024.04
pkgrel=0
pkgdesc="Rakudo modules distribution"
url="https://rakudo.org/star/"
# ppc64le, s390x, riscv64: follow rakudo aport
arch="all !ppc64le !s390x !riscv64"
license="Artistic-2.0"
depends="libssl3 rakudo>$pkgver readline"
makedepends="bash perl-utils libffi-dev libuv-dev zstd-dev"
# net: download missing dependencies, !check: no unified test suite
options="net !check"
source="https://github.com/rakudo/star/releases/download/$pkgver/rakudo-star-$pkgver.tar.gz
	rakudo-not-perl6.patch
	openssl-nativelib.patch
	use-newer-versions.patch
	reorder-modules.patch
	lock-depends-version.patch
	"
_prefixdir="$srcdir"/prefix
_rakudodir="$_prefixdir"/share/rakudo

prepare() {
	default_prepare

	install -dv "$_prefixdir"/bin "$_rakudodir"
	ln -sv /usr/bin/raku "$_prefixdir"/bin/
	ln -sv /usr/share/rakudo/core "$_rakudodir"/
}

build() {
	export RAKUDO_PREFIX="$_rakudodir"
	./bin/rstar install -p "$_prefixdir" modules
}

package() {
	install -dv "$pkgdir"/usr/share/rakudo
	cp -a "$_rakudodir"/site "$pkgdir"/usr/share/rakudo/
}

sha512sums="
f64ee0eb14a09009710c68d78b6e6fd9d100c850f9154b0c9f617e73634875d3978b834bde71497fcd59213734261f7496485353a4523421c591b04855c2ddf3  rakudo-star-2024.04.tar.gz
c915cfab907b266d674e796b364ccc61d677773295c5962d5775faf7fab32f02d743c9b4f72d49890f94174481a5ec47c03409dcece0d71a4a0dbf4cf249de14  rakudo-not-perl6.patch
cee4eb863c9c6f66ee02e9d16171ad766daa881135c747e4b9b43b1e40442ed2384a6586f090dfe6014b48871873bb109ec76abf45447b72d9a2b5ab63d2e71d  openssl-nativelib.patch
29be28af0ce4ddd3d2f4f98a3acbc2684dd29aced756fa08e1ee0bade92af6fb5d786d180740c48abe41138cefcc9cf8a0a86d88248e98804070c875a15e07cc  use-newer-versions.patch
12a46287ba873ad3d63e51fe21a3db3014e3d1d614a63bed0565cee9dd46e7eb82c88516aabd07932b57fdb2f57997e9de96e653409833689a6d038d0591eab8  reorder-modules.patch
03b71414fe3cb650bcaf5f230ec32b1e879c670dcdd46cb07947f41048c02134559501e16f056ece0a41fb5b7e12e7551407adb95aa46eb9846b80944987bc3e  lock-depends-version.patch
"
